<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img
        class="banner-image"
        src="//img1.qunarzz.com/sight/p0/1907/92/92572ec6bd572491a3.img.jpg_600x330_7a483918.jpg"
      />
      <div class="banner-info">
        <div class="banner-number">
          <span class="iconfont">&#xe60b;</span>
          <span>8</span>
        </div>
        <div class="banner-title">亚特兰蒂斯水世界</div>
      </div>
    </div>
    <!-- @closeGallery监听子组件传递过来的方法 -->
    <common-gallery
      :imgsList="imgsList"
      v-show="isGalleryShow"
      @closeGallery="handleGalleryClose"
    ></common-gallery>
  </div>
</template>

<script>
import CommonGallery from "common/gallery/Gallery";
export default {
  name: "Banner",
  data: function () {
    return {
      isGalleryShow: false,
      imgsList: [
        "http://img1.qunarzz.com/sight/p0/1906/f4/f4ecc654b2cc64d0a3.img.jpg_r_800x800_7a1affd6.jpg",
        "http://img1.qunarzz.com/sight/p0/1906/f4/f4ecc654b2cc64d0a3.img.jpg_r_800x800_7a1affd6.jpg",
      ],
    };
  },
  components: {
    commonGallery: CommonGallery,
  },
  methods: {
    handleBannerClick: function () {
      this.isGalleryShow = true;
    },
    handleGalleryClose: function () {
      this.isGalleryShow = false;
    },
  },
};
</script>

<style lang="stylus" scoped>
.banner {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 55%;
  background-color: #eee;
}

.banner .banner-image {
  width: 100%;
}

.banner .banner-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  color: #fff;
  line-height: 0.6rem;
  padding: 0 0.2rem 0.2rem;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.6));
}

.banner .banner-info .banner-number {
  width: 1.2rem;
  height: 0.4rem;
  line-height: 0.4rem;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 0.2rem;
  font-size: 0.24rem;
}

.banner .banner-info .banner-title {
  width: 100%;
  height: 0.6rem;
  line-height: 0.6rem;
  font-size: 0.36rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
</style>